package com.azier.kapacitor.script.node;

import com.azier.kapacitor.script.method.*;
import com.azier.kapacitor.script.node.nodebind.*;
import com.azier.kapacitor.script.node.nodebind.qlnodebind.*;

import java.util.ArrayList;

/**
* 1 * @Author: luoj
* 2 * @Date: 2019/11/8 11:27
* 3
*/

/**
Create a node that can trigger autoscale events for an EC2 Autoscale group.
**/
/**
创建一个可以触发EC2自动缩放组的自动缩放事件的节点。
**/
public class Ec2AutoscaleNode extends AbstractNode implements AlertNodeBind, BarrierNodeBind, BottomNodeBind, ChangeDetectNodeBind, CombineNodeBind,
        CountNodeBind, CumulativeSumNodeBind, DefaultNodeBind, DeleteNodeBind, DerivativeNodeBind, DifferenceNodeBind, DistinctNodeBind,
        Ec2AutoscaleNodeBind, ElapsedNodeBind, EvalNodeBind, FirstNodeBind, FlattenNodeBind, GroupByNodeBind, HoltWintersNodeBind,
        HoltWintersWithFitNodeBind, HttpOutNodeBind, HttpPostNodeBind, InfluxDBOutNodeBind, JoinNodeBind, K8sAutoscaleNodeBind,
        KapacitorLoopbackNodeBind, LastNodeBind, LogNodeBind, MeanNodeBind, MedianNodeBind, ModeNodeBind, MovingAverageNodeBind,
        PercentileNodeBind, SampleNodeBind, ShiftNodeBind, SideloadNodeBind, SpreadNodeBind, StateCountNodeBind, StateDurationNodeBind,
        StatsNodeBind, StddevNodeBind, SumNodeBind, SwarmAutoscaleNodeBind, TopNodeBind, UnionNodeBind, WhereNodeBind, WindowNodeBind{
    private static final String name = "ec2Autoscale";

    public Ec2AutoscaleNode() {
        super(new ArrayList<>(),new ArrayList<>(),name);
    }

    /**
    Cluster is the ID of EC2 Autoscale group to use. The ID of the cluster is specified in the kapacitor configuration.
    **/
    /**
    群集是要使用的EC2 Autoscale组的ID。集群的ID在kapacitor配置中指定。
    **/
    public Ec2AutoscaleNode cluster(String ec2Autoscale){
        Cluster cluster = new Cluster(ec2Autoscale);
        super.addMethod(cluster);
        return this;
    }
    /**
    CurrentField is the name of a field into which the current replica count will be set as an int. If empty no field will be set. Useful for computing deltas on the current state.
    **/
    /**
    CurrentField是将当前副本计数设置为int的字段名称。如果为空，则不会设置任何字段。用于计算当前状态的增量。
    **/
    public Ec2AutoscaleNode currentField(String ec2Autoscale){
        CurrentField currentField = new CurrentField(ec2Autoscale);
        super.addMethod(currentField);
        return this;
    }
    /**
    Only one decrease event can be triggered per resource every DecreaseCooldown interval.
    **/
    /**
    每个DecreaseCooldown间隔每个资源只能触发一个减少事件。
    **/
    public Ec2AutoscaleNode decreaseCooldown(long interval, String durationLiteral){
        DecreaseCooldown decreaseCooldown = new DecreaseCooldown(interval, durationLiteral);
        super.addMethod(decreaseCooldown);
        return this;
    }
    /**
    GroupName is the name of the autoscaling group to autoscale.
    **/
    /**
    GroupName是要自动缩放的自动缩放组的名称。
    **/
    public Ec2AutoscaleNode groupName(String ec2Autoscale){
        GroupName groupName = new GroupName(ec2Autoscale);
        super.addMethod(groupName);
        return this;
    }
    /**
    GroupName is the name of a tag which contains the name of the autoscaling group to autoscale.
    **/
    /**
    GroupName是标签的名称，其中包含要自动缩放的自动缩放组的名称。
    **/
    public Ec2AutoscaleNode groupNameTag(String ec2Autoscale){
        GroupNameTag groupNameTag = new GroupNameTag(ec2Autoscale);
        super.addMethod(groupNameTag);
        return this;
    }
    /**
    Only one increase event can be triggered per resource every IncreaseCooldown interval.
    **/
    /**
    每个增量冷却间隔每个资源只能触发一个增加事件。
    **/
    public Ec2AutoscaleNode increaseCooldown(long interval, String durationLiteral){
        IncreaseCooldown increaseCooldown = new IncreaseCooldown(interval, durationLiteral);
        super.addMethod(increaseCooldown);
        return this;
    }
    /**
    The maximum scale factor to set. If 0 then there is no upper limit. Default: 0, a.k.a no limit.
    **/
    /**
    要设置的最大比例因子。如果为0，则没有上限。默认值：0，又称无限制
    **/
    public Ec2AutoscaleNode max(long ec2Autoscale){
        Max max = new Max(ec2Autoscale);
        super.addMethod(max);
        return this;
    }
    /**
    The minimum scale factor to set. Default: 1
    **/
    /**
    要设置的最小比例因子。默认值：1
    **/
    public Ec2AutoscaleNode min(long ec2Autoscale){
        Min min = new Min(ec2Autoscale);
        super.addMethod(min);
        return this;
    }
    /**
    OutputGroupName is the name of a tag into which the group name will be written for output autoscale events. Defaults to the value of GroupNameTag if its not empty.
    **/
    /**
    OutputGroupName是标签的名称，对于输出自动缩放事件，组名称将写入该名称。如果不为空，则默认为GroupNameTag的值。
    **/
    public Ec2AutoscaleNode outputGroupNameTag(String ec2Autoscale){
        OutputGroupNameTag outputGroupNameTag = new OutputGroupNameTag(ec2Autoscale);
        super.addMethod(outputGroupNameTag);
        return this;
    }
    /**
    Suppress all error logging events from this node.
    **/
    /**
    禁止来自此节点的所有错误记录事件。
    **/
    public Ec2AutoscaleNode quiet(){
        Quiet quiet = new Quiet();
        super.addMethod(quiet);
        return this;
    }
    /**
    Replicas is a lambda expression that should evaluate to the desired number of replicas for the resource.
    **/
    /**
    副本是一个lambda表达式，其值应为资源的所需副本数。
    **/
    public Ec2AutoscaleNode replicas(String condition){
        Replicas replicas = new Replicas(condition);
        super.addMethod(replicas);
        return this;
    }
}